{include file='account/header.tpl'}
{include file="account/leftcol.tpl"}
<div id="left-area">
    <div class="entry post clearfix width-for-all-img">
        <div class="breadcrumb">
            <span class="raquo"></span><a href="/">Главная</a>
            <span class="raquo"> &raquo; </span><a href="{geturl controller='account' action='index'}">Профиль</a>  
            <span class="raquo"> &raquo; </span><a href="{geturl controller='account' action='setting'}">Настройки</a>  
        </div>
        <h1 class="prof-title">Настройки</h1>
        <div id="tabs" class="htabs">
            <a href="#tab-1" class="selected">Настройки</a>
            <a href="#tab-2">Уведомления</a>

        </div>
 <form action="{geturl controller="account" action="setting"}" method="post">

        <div id="tab-1" class="tab-content">
            <div class="row">
                    <label for="form_name">Валюта сайта:</label>
                    <select name="currency" >
                        {foreach from=$curr item='cur'}
                            {if $user->currency==$cur.id}
                        <option value="{$cur.id}" selected="">{$cur.title}</option>
                        {else}
                           <option value="{$cur.id}" >{$cur.title}</option>   
                            {/if}
                      {/foreach}
                    </select>

                </div>
        <div class="row">
            <label for="form_color">Логотип:</label>
            <div id="uploadHolder"><input id="uploadBtn" type="button" value="Загрузить" /></div>
            <input id="cropBtn" type="button" value="Обрезать"/>
            <input id="deleteBtn" type="button" value="Удалить" />

            <input type="hidden" id="url" name="logo" readonly="readonly" style="width:300px" value="{$user->photo}"/>
            <div style="clear:both;"></div>
            <div>
                <img id="img" src="{$user->photo}" alt=""  style="width:200px" />
            </div>
        </div>
       
        </div>
        <div id="tab-2" class="tab-content">
            <div class="row">
                <label for="form_name">Настройка уведомлений</label><br />
            <div class="grid-380">
               <div id="divPS2"><label for="new_pm"><input type="checkbox" name="new_pm" value="2"{if $nt && $nt->new_pm == 1} checked="checked"{/if}> Уведомлять меня о новых личных сообщениях</label></div>
               <div id="divPS2"><label for="new_com"><input type="checkbox" name="new_com" value="2"{if $nt && $nt->new_com == 1} checked="checked"{/if}> Уведомлять меня о новых комментариях</label></div>
               <div id="divPS2"><label for="new_req"><input type="checkbox" name="new_req" value="2"{if $nt && $nt->new_req == 1} checked="checked"{/if}> Уведомлять меня о новых заявках в друзья</label></div>
               <div id="divPS2"><label for="acc_req"><input type="checkbox" name="acc_req" value="2"{if $nt && $nt->acc_req == 1} checked="checked"{/if}> Уведомлять меня об одобрении заявок в друзья</label></div>
               <div id="divPS2"><label for="new_order"><input type="checkbox" name="new_order" value="2"{if $nt && $nt->new_order == 1} checked="checked"{/if}> Уведомлять меня о новых заказах в моем магазине</label></div>
           <br /><div class="text-desc gray">Отметьте галочкой те уведомления о событиях, которые вы хотели бы получать.</div>
            </div>
        </div>
        </div>
       <input type="submit" name="submit" class="button pink" value="Сохранить"/>
 </form>
    </div></div>
    {literal}
    
<style type="text/css">
#uploadHolder, #cropBtn, #deleteBtn {
	float: left;
}
#uploadBtn, #cropBtn, #deleteBtn {
	border-style: solid;
	border-color: black;
}

#uploadHolder:hover #uploadBtn, #cropBtn:hover, #deleteBtn:hover {
	border-color: #999;
}
</style>    
<script type="text/javascript">
$(function () {
	var img = new ImageUploader({
		img: $("#img"),
		loaderURL: "/images/loader.gif",
			
		targetWidth: 50,
		targetHeight: 50,
			
		hidden: $("#url"), //для сохранения ссылки на картинку	
				
		cropURL: "/account/addlogotest",
		cropParams: {},
		
		uploadURL: "/account/upload",
		uploadParams: {},
			
		allowedExtensions: ["jpg", "jpeg", "gif", "png"],
			
		uploadBtn: $("#uploadHolder"),
		deleteBtn: $("#deleteBtn"),
		cropBtn: $("#cropBtn")		
	});
	
	//img.remove();
});
</script>
    
    <script type="text/javascript"><!--
  $('#tabs a').tabs();

  /*  $(document).ready(function() {
        $('#target').Jcrop({
                    aspectRatio: 1,
                  
                    allowSelect:false,
                    onChange:   updateCoords,
                    onSelect:   updateCoords,
                    setSelect: [ 0, 0, 150, 150 ]
                        },function(){
                    jcrop_api = this;
                  });
              });*/
          //--></script> 
    <script type="text/javascript">
        $('#save_logo').click(function() {
            var c_filename = $('#file').val();
            var c_x = $('#x1').val();
            var c_y = $('#y1').val();
            var c_x2 = $('#x2').val();
            var c_y2 = $('#y2').val();
            var c_w = $('#w').val();
            var c_h = $('#h').val();

            var c_file = $('#file').val();
            //var data={filename:c_filename,x1:c_x,x2:c_x2,y1:c_y,y2:c_y2,h:c_h,w:c_w};


            $.ajax({
                type: "POST",
                url: "/account/ajaxfile/",
                data: {
                    file: c_file,
                    x1: c_x,
                    x2: c_x2,
                    y1: c_y,
                    y2: c_y2,
                    h: c_h,
                    w: c_w
                },
                success: function(data1) {
                   // alertify.alert('Аватарка сохранена');
                    window.location.reload();
                    //console.log(data1); 

                }
            });

        });

    </script>
{/literal}
{include file='account/footer.tpl'}